﻿@using Domain
@using WebUI.Extensions
@using Framework.HtmlHelpers
@using Framework.Models
@{
	Layout = null;
	CurrentAccountModel currentAccount = ViewBag.CurrentAccount;
	UserInfo currentUserInfo = currentAccount.UserInfo;
	string roleName = ViewBag.RoleName;
}

<li class="dropdown user user-menu">
	<!-- Menu Toggle Button -->
	<a href="#" class="dropdown-toggle" data-toggle="dropdown">
		<!-- The user image in the navbar-->
		<img src="@currentUserInfo.Avatar" class="user-image" alt="User Image">
		<!-- hidden-xs hides the username on small devices so only the image appears. -->
		<span class="hidden-xs">@currentUserInfo.Name</span>
	</a>
	<ul class="dropdown-menu">
		<!-- The user image in the menu -->
		<li class="user-header">
			<img src="@currentUserInfo.Avatar" class="img-circle" alt="User Image">

			<p>
				@currentUserInfo.Name - @roleName
				@if (!currentAccount.IsGuest)
				{
					<small>加入自 @currentUserInfo.RegTime.ToRegTime()</small>
				}
			</p>
		</li>
		<!-- Menu Body -->
		<li class="user-body">
			@if (!currentAccount.IsGuest)
			{
				<div class="row">
					<div class="col-xs-4 text-center">
						<a href="#">花朵</a>
					</div>
					<div class="col-xs-4 text-center">
						<a href="#">销量</a>
					</div>
					<div class="col-xs-4 text-center">
						<a href="#">好友</a>
					</div>
				</div>
				<!-- /.row -->
			}
		</li>
		<!-- Menu Footer-->
		<li class="user-footer">
			@if (!currentAccount.IsGuest)
			{
				<div class="pull-left">
					<a href="@Url.Action("Index", "Profile", new { area = "Account", loginAccount = currentUserInfo.UserName })" class="btn btn-default btn-flat">个人中心</a>
				</div>
				<div class="pull-right">
					<a href="@Url.Action("Exit", "Login", new { area = "Account", returnUrl = Request.Url.AbsoluteUri })" class="btn btn-default btn-flat">退出</a>
				</div>
				if (Html.HasAuth("Admin.Home.Index"))
				{
					<div class="pull-right">
						<a href="@Url.Action("Index", "Home", new { area = "Admin" })" class="btn btn-default btn-flat"><i class="fa fa-gear"></i><span>管理中心</span></a>
					</div>
				}
			}
			else
			{
				<div class="pull-left">
					<a href="@Url.Action("Index", "Login", new { area = "Account", returnUrl = Request.Url.AbsoluteUri })" class="btn btn-default btn-flat">登录</a>
				</div>
				<div class="pull-right">
					<a href="@Url.Action("Index", "Register", new { area = "Account", returnUrl = Request.Url.AbsoluteUri })" class="btn btn-default btn-flat">注册</a>
				</div>
			}
		</li>
	</ul>
</li>
